function configPortlet(holderId,channelId){
	var url = "../../portlet/toConfigHorder?horderChannelId="+channelId+"&placeholderId="+holderId;
	opendailog("{src:'"+url+"',title:'添加功能',width:700,height:480,savefunc:'savefunc1'}",window);
}
function deletePortlet(id,portletype){
	if(confirm('are you sure delete this portlet?')){
		document.getElementById(id).removeNode(true);
		$.ajax({
		   type: "GET",
		   url: "/cms/portlet/delete/"+id+"?portletype="+portletype,
		   error: function(){
		   		alert("err~ please try again");
		   }
		});	
	}
}
function editPortlet(id,portletype){
	var url = "../../portlet/toForm/"+id+"?portletype="+portletype;
	opendailog("{src:'"+url+"',title:'修改功能',width:600,height:450,savefunc:'savefunc1'}",window);
}
function savefunc1(frame){
	var retv = frame.contentWindow.save();
	if(retv=="success"){
		alert("保存成功!");
		window.location.reload();
	}
	return retv;
}

$(function(){
	$( ".column" ).sortable({
		connectWith: ".column",
		stop: function(event, ui) {
			  var xx = $('#column-1').sortable('toArray');
			  var _p_column_id = ui.item.parent()[0].id;
			  var _p_column_array = ui.item.parent().sortable('toArray');
			  $.ajax({
			   type: "POST",
			   url: "../../placeholder/savePortletNewPlace",
			   data: "column_id="+_p_column_id+"&column_array="+_p_column_array,
			   error: function(){
			   		alert("update place err try again!");
			   }
			});				 
		}
	});
	$( ".column" ).disableSelection();
});